package com.atwulidun.bridge06;

// 用抽象类而不用接口的目的是为了把聚合的phoneBrand给继承下去
public abstract class PhonePattern {
    // 聚合PhoneBrand
    protected PhoneBrand phoneBrand;

    public PhonePattern(PhoneBrand phoneBrand) {
        this.phoneBrand = phoneBrand;
    }

    // 输出手机样式和品牌的抽象方法，用到了聚合进来的phoneBrand
    public abstract void getPhonePatternAndBrand();
}

class Folded extends PhonePattern {
    public Folded(PhoneBrand phoneBrand) {
        super(phoneBrand);
    }

    @Override
    public void getPhonePatternAndBrand() {
        System.out.println("折叠式的" + phoneBrand.getPhoneBrand() + "手机");;
    }
}

class Upright extends PhonePattern {
    public Upright(PhoneBrand phoneBrand) {
        super(phoneBrand);
    }

    @Override
    public void getPhonePatternAndBrand() {
        System.out.println("直立式的" + phoneBrand.getPhoneBrand() + "手机");;
    }
}